import request from '@/utils/request'
import { apiVersion } from '@/config'

// 全部）
export function getAllMarkets(data) {
  return request({
    url: `/admin/${apiVersion}/market/all`,
    method: 'get',
    data
  })
}
export function getMarkets(data) {
  return request({
    url: `/admin/${apiVersion}/market`,
    method: 'get',
    data
  })
}
/**
 * 添加
 * @param {} data 
 */
export function addMarket(data) {
  return request({
    url: `/admin/${apiVersion}/market`,
    method: 'post',
    data: data
  })
}
/**
 * 删除
 * @param {} data 
 */
export function delMarket(data) {
  return request({
    url: `/admin/${apiVersion}/market/${data.id}`,
    method: 'delete',
    data: data
  })
}
/**
 * 更新
 * @param {} data 
 */
export function putMarket(data) {
  return request({
    url: `/admin/${apiVersion}/market`,
    method: 'put',
    data: data
  })
}
/**
 * 取得详情
 * @param {*} data 
 */
export function getMarketDetail(id) {
  return request({
    url: `/admin/${apiVersion}/markte/${id}`,
    noLoadding: true,
    method: 'get',
  })
}
